/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
* ProgCurveOModel.java
*
* Created on December 29, 2007, 10:39 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
 */
package gui.genomemap.outputModel;

import gui.genomemap.outputModel.options.ProgCurveOOptionsModel;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author stewari1
 */
@Entity
public class ProgCurveOModel extends OutputModel implements java.io.Serializable {

    /** Field description */
    public static final int FIG_PROG_CURVE = 0;

    /** Field description */
    @OneToMany(cascade = CascadeType.ALL)
    private Set<AnnealOModel> annealOModelSet = null;

    /** Field description */
    @OneToOne(cascade = CascadeType.ALL)
    private ProgCurveOOptionsModel optionsModel = null;

    /** Creates a new instance of ProgCurveOModel */
    public ProgCurveOModel() {

        optionsModel    = new ProgCurveOOptionsModel();
        annealOModelSet = new LinkedHashSet<>();
    }

    @Override
    public int hashCode() {
        return super.hashCode() + getAnnealOModelSet().hashCode();
    }

    @Override
    public boolean equals(Object obj) {

        if (obj instanceof ProgCurveOModel) {

            ProgCurveOModel progCurveOModel = (ProgCurveOModel) obj;

            return super.equals(progCurveOModel)
                   && getAnnealOModelSet().equals(progCurveOModel.getAnnealOModelSet());
        }

        return false;
    }

    public ProgCurveOOptionsModel getOptionsModel() {
        return optionsModel;
    }

    public void setOptionsModel(ProgCurveOOptionsModel optionsModel) {
        this.optionsModel = optionsModel;
    }

    public Set<AnnealOModel> getAnnealOModelSet() {
        return annealOModelSet;
    }

    public void setAnnealOModelSet(Set<AnnealOModel> annealOModelSet) {
        this.annealOModelSet = annealOModelSet;
    }
}
